<%@ Page Language="C#" MasterPageFile="~/UI/Masters/Content.master" AutoEventWireup="true" CodeBehind="Add.aspx.cs" Inherits="Stratman.Web.VSTS.UI.Pages.Timesheet.Add" %>
<%@ Register Assembly="Microsoft.TeamFoundation.WebAccess.Controls" Namespace="Microsoft.TeamFoundation.WebAccess.Controls" TagPrefix="dbz" %>
<%@ Register TagPrefix="uc1" Src="~/UI/Controls/WorkItems/WorkItemFinder.ascx" TagName="WorkItemFinder" %>

<asp:Content ID="c" ContentPlaceHolderID="c" runat="server">
    <script language="javascript" type="text/javascript">
        var changeQueue = new Array();
        
        function PerformAdd()
        {
            var selectedWorkItems = document.all("selectedWorkItems");
            var timeAmountType = document.all("timeAmountType");
        
            if (!_ctl00_c_timeAmountTypeDropdown.m_text)
            {
                alert("Value cannot be empty");
                return;
            }
        
            timeAmountType.value = _ctl00_c_timeAmountTypeDropdown.m_text;
        
            for (var i = 0; i < _ctl00_c_wif_sw1.getSelectedItems().length; i++)
            {
                var workItem = _ctl00_c_wif_sw1.getSelectedItems()[i];
                selectedWorkItems.value += workItem.id + ",";
            }
            
            if (selectedWorkItems.value != "")
            {
                selectedWorkItems.value = selectedWorkItems.value.substring(0, selectedWorkItems.value.length - 1);
                document.all("form2").submit();
            }
        }
    </script>

    <asp:Literal ID="ltlError" runat="server"></asp:Literal>
    
    <div align="left" class="hd"><b>Add Work Item To Timesheet</b></div><br />
        
	<uc1:WorkItemFinder ID="wif" runat="server" />
	
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
	    <colgroup>
	        <col style="width: 20%" />
	        <col style="width: 80%" />
	    </colgroup>
	    <tr>
	        <td>Time amount type:</td>
	        <td><dbz:EditableDropDown ID="timeAmountTypeDropdown" runat="server" Required="true" Width="100%" CausesValidation="true" /></td>
	    </tr>
	</table>
</asp:Content>

<asp:Content ID="d" ContentPlaceHolderID="d" runat="server">
    <form id="form2" method="post">
        <input type="hidden" id="timeAmountType" name="timeAmountType" />
        <input type="hidden" id="selectedWorkItems" name="selectedWorkItems" />
    </form>
</asp:Content>
